<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>新增/编辑装货区域</h2>
    </div>
    <form action="" method="post" class="form-horizontal">
        <input type="hidden" name="id" id="id" value="{$data['loadarea_id']}">
        <div class="form-item">
            <label class="item-label">装货区域名称</label>
            <div class="controls">
                <input type="text" class="text input-large" name="loadarea_name" value="{$data['loadarea_name']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">所属城市</label>
            <div class="controls">
                <select name="pid" id="js-sheng">
                    <option value="0" >请选择省</option>

                    <notempty name="plist">
                        <volist name="plist" id="vo">
                            <option value ="{$vo.id}" <?php if($data['province']==$vo['name']){ echo 'selected';} ?>>{$vo.name}</option>
                        </volist>
                    </notempty>

                </select> 

                <select name="cid" id="js-shi">
                    <option value="0" >请选择市</option>

                    <notempty name="clist">
                        <volist name="clist" id="vo">
                            <option value ="{$vo.id}" <?php if($data['city']==$vo['name']){ echo 'selected';} ?>>{$vo.name}</option>
                        </volist>
                    </notempty>

                </select> 
            </div>
        </div>
        <notempty name="lalist">
            <volist name="lalist" id="vo">
                <div class="form-item">
                    <label class="item-label">{$vo.port_name}价格:</label>
                    <input type="hidden" name="{$vo.port_id}-ppid" value="{$vo.port_price_id}">
                    <div class="controls">
                        <table border="1" style="width: 60%">
                            <thead>
                                <tr style="background: #CCC;">
                                    <th>
                                        结算方式/箱型
                                    </th>
                                    <th>
                                        小柜拼车
                                    </th>
                                    <th>
                                        小柜单放
                                    </th>
                                    <th>
                                        大柜
                                    </th>
                                    <th>
                                        高柜
                                    </th>
                                    <th>
                                        超高柜
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC;">
                                        运价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-small_carpool" value="{$vo.freight_list.small_carpool}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-small_single" value="{$vo.freight_list.small_single}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-big_cabinet" value="{$vo.freight_list.big_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-tall_cabinet" value="{$vo.freight_list.tall_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-super_tall_cabinet" value="{$vo.freight_list.super_tall_cabinet}">
                                    </td>
                                </tr>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC; text-align: center">
                                        现金价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-small_carpool" value="{$vo.cash_list.small_carpool}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-small_single" value="{$vo.cash_list.small_single}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-big_cabinet" value="{$vo.cash_list.big_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-tall_cabinet" value="{$vo.cash_list.tall_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-super_tall_cabinet" value="{$vo.cash_list.super_tall_cabinet}">
                                    </td>
                                </tr>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC; text-align: center">
                                        司机结算价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-small_carpool" value="{$vo.settlement_list.small_carpool}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-small_single" value="{$vo.settlement_list.small_single}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-big_cabinet" value="{$vo.settlement_list.big_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-tall_cabinet" value="{$vo.settlement_list.tall_cabinet}">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-super_tall_cabinet" value="{$vo.settlement_list.super_tall_cabinet}">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </volist>
            <else/>
            <volist name="polist" id="vo">
                <div class="form-item">
                    <label class="item-label">{$vo.port_name}价格:</label>
                    <div class="controls">
                        <table border="1" style="width: 60%">
                            <thead>
                                <tr style="background: #CCC;">
                                    <th>
                                        结算方式/箱型
                                    </th>
                                    <th>
                                        小柜拼车
                                    </th>
                                    <th>
                                        小柜单放
                                    </th>
                                    <th>
                                        大柜
                                    </th>
                                    <th>
                                        高柜
                                    </th>
                                    <th>
                                        超高柜
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC;">
                                        运价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-small_carpool">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-small_single">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-big_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-tall_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-freight-super_tall_cabinet">
                                    </td>
                                </tr>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC; text-align: center">
                                        现金价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-small_carpool">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-small_single">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-big_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-tall_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-cash-super_tall_cabinet">
                                    </td>
                                </tr>
                                <tr style="text-align: center">
                                    <td  style="background: #CCC; text-align: center">
                                        司机结算价
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-small_carpool">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-small_single">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-big_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-tall_cabinet">
                                    </td>
                                    <td>
                                        <input type="text" class="input-2x" name="{$vo.port_id}-settlement-super_tall_cabinet">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </volist>
        </notempty>


        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        $("#js-sheng").change(function () {
            var id = $(this).val();
            $.post("{:U('getCityByPid')}", {id: id}, function (res) {
                if (res.status) {
                    var option = '';
                    $.each(res.url, function (index, obj) {
                        option += "<option value=\"" + obj.id + "\">" + obj.name + "</option>";
                    });
                    $("#js-shi").html(option);
                }
            });
        });
        //导航高亮
        highlight_subnav('{:U('LoadArea / index')}');
    </script>
</block>
